#include <iostream>
#include <string>
#include "addressbook.pb.h"

using namespace std;

int main(int argc, char *argv[]) {
    GOOGLE_PROTOBUF_VERIFY_VERSION;
    tutorial::EffectParam effectparam;
    {
        auto presetParam = effectparam.mutable_preset_param();
        presetParam->set_prefer_tab(1);
        presetParam->set_preset(22);
        presetParam->set_preset_mode(1);

        auto portraitBeautify = effectparam.mutable_portrait_beautify();
        auto facialOptimize = portraitBeautify->mutable_facial_optimize();

        tutorial::PeopleValue peopleValue;
        auto fun = [](auto *peopleValue) {
            peopleValue->set_man(50);
            peopleValue->set_woman(50);
            peopleValue->set_child(50);
            peopleValue->set_old_man(50);
            peopleValue->set_old_woman(50);
        };

        fun(facialOptimize->mutable_face_restore_alpha());
        fun(facialOptimize->mutable_wrinkle_forehead_removal_alpha());
        fun(facialOptimize->mutable_wrinkle_periorbital_removal_alpha());
        fun(facialOptimize->mutable_wrinkle_nasolabial_removal_alpha());
        fun(facialOptimize->mutable_wrinkle_cheek_removal_alpha());
        fun(facialOptimize->mutable_wrinkle_neck_removal_alpha());
        fun(facialOptimize->mutable_remove_pouch());
        fun(facialOptimize->mutable_shiny_clean_alpha());
        fun(facialOptimize->mutable_fleck_clean_flag());
        fun(facialOptimize->mutable_nevus_removal_flag());
        fun(facialOptimize->mutable_black_head_clean_flag());
        fun(facialOptimize->mutable_double_chin());
        fun(facialOptimize->mutable_lip_remove_alpha());


      auto  imageBeautify = effectparam.mutable_image_beautify();
      auto skyBackground = imageBeautify->mutable_sky_background();
      skyBackground->set_image("D://image/213.jpg");
      skyBackground->set_id(1);

//    auto bodyOptimize = portraitBeautify->mutable_body_optimize();
//    auto smoothSkin = portraitBeautify->mutable_smooth_skin();
//    auto skinAdjustment = portraitBeautify->mutable_skin_adjustment();
//    auto facialReshape = portraitBeautify->mutable_facial_reshape();
//    auto facialRemodel = portraitBeautify->mutable_facial_remodel();
//    auto makeupAdjustment = portraitBeautify->mutable_makeup_adjustment();
//    auto teethOptimize = portraitBeautify->mutable_teeth_optimize();
//    auto hairBeautify = portraitBeautify->mutable_hair_beautify();
//    auto singleBeautify = portraitBeautify->mutable_single_beautify();
//    auto multipleBeautify = portraitBeautify->mutable_multiple_beautify();
//
//    auto clothDefold = effectparam.mutable_cloth_defold();
//    auto imageBeautify = effectparam.mutable_image_beautify();
//    auto imageAdjust = effectparam.mutable_image_adjust();
//    auto filter = effectparam.mutable_filter();
//    auto clipData = effectparam.mutable_clip_data();

    }
    std::string output;
    if (!effectparam.SerializeToString(&output)) {
        std::cerr << "Failed to serialize effect param." << std::endl;
        return 1;
    }
    std::cout << "serialize data :" << output;
    {
        tutorial::EffectParam param;
        if (!param.ParseFromString(output)) {
            std::cerr << "Failed to parse effect param." << std::endl;
            return 1;
        }
        auto presetParam = param.mutable_preset_param();
        auto portraitBeautify = param.mutable_portrait_beautify();
        auto facialOptimize = portraitBeautify->mutable_facial_optimize();

    }



//    tutorial::MTDetector mtDetector;
//    mtDetector.set_faceidmaxvalid(6);
//    mtDetector.set_facecount(5);
//   auto facePoints = mtDetector.mutable_facepoints();
//    tutorial::FloatVector floatVect;
//    floatVect.add_value(10);
//    floatVect.add_value(12);
//    floatVect.add_value(14);
//    floatVect.add_value(15);
//    floatVect.add_value(16);
//
//    facePoints->add_value(floatVect);

    return 0;
}